package com.ossfk.jt808;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;

import com.ossfk.jt808.client.Jt808Client;
import com.ossfk.jt808.pojo.info.Jt808TerminalRegistInfo;
import com.ossfk.jt808.pojo.req.Jt808TerminalRegistReq;

@SpringBootApplication
public class OssfkJt808ClientApplication {

	public static void main(String[] args) throws Exception {
		ApplicationContext context = SpringApplication.run(OssfkJt808ClientApplication.class, args);
		Jt808Client jt808Client = context.getBean(Jt808Client.class);
		jt808Client.connect();
		Thread.sleep(5000l);
		if (jt808Client.getSession() != null) {
			Jt808TerminalRegistReq msg = new Jt808TerminalRegistReq(jt808Client.getSession());
			Jt808TerminalRegistInfo info = new Jt808TerminalRegistInfo();
			info.setCityId(0);
			info.setLicensePlate("湘A88888");
			info.setLicensePlateColor(2);
			info.setManufacturerId("");
			info.setTerminalId("654321");
			info.setTerminalType("A6BD");
			msg.setTerminalRegInfo(info);
			jt808Client.sendMsg(msg);
		}
	}

}
